import json
from django.middleware.csrf import get_token ,rotate_token
from django.http import HttpResponse, HttpRequest
from . import define_info

_info = define_info.res_info


def token(request):
    if request.method == 'GET':
        _info['msg'] = 'successful'
        _info['result'] = {'token': get_token(request)}

        print('get token!!')

        return HttpResponse(json.dumps(_info, ensure_ascii=False), content_type="application/json,charset=utf-8")
